Review


Problem 1
Compute the table of variables and the output of the code shown. Suppose there is a textbox called tbx1 with the property of multiline. Create a Wintempla Dialog application called Dylan to verify your results.
Calcule la tabla de variables y la salida del código de abajo. Suponga que hay una caja de texto llamada tbx1 con la propiedad de multilínea. Cree una aplicación de Dialogo de Wintempla llamada Dylan para verificar sus resultados.

Dylan.cpp
void Dylan::Window_Open(Win::Event& e)
{
     wchar_t text[64];
     double x = 1.0;
     for(int j = 5; j > 3; j--) x += j;

     _snwprintf_s(text, 64, _TRUNCATE, L"%f", x);
     this->MessageBox(L"", text, MB_OK);
}

Problem1

Problem 2
Compute the table of variables and the output of the code shown. Suppose there is a textbox called tbx1 with the property of multiline. Create a Wintempla Dialog application called Dylan to verify your results.
Calcule la tabla de variables y la salida del código de abajo. Suponga que hay una caja de texto llamada tbx1 con la propiedad de multilínea. Cree una aplicación de Dialogo de Wintempla llamada Dylan para verificar sus resultados.

Dylan.cpp
void Dylan::Window_Open(Win::Event& e)
{
     wchar_t text[64];
     for(int n = 0; n <= 100; n++)
     {
          if (n%2 != 0) continue;
          _snwprintf_s(text, 64, _TRUNCATE, L"%d ", n);
          this->tbx1.Text += text;
     }     
}

Problem2

Problem 3
Compute the table of variables and the output of the code shown. Suppose there is a textbox called tbx1 with the property of multiline. Create a Wintempla Dialog application called Dylan to verify your results.
Calcule la tabla de variables y la salida del código de abajo. Suponga que hay una caja de texto llamada tbx1 con la propiedad de multilínea. Cree una aplicación de Dialogo de Wintempla llamada Dylan para verificar sus resultados.

Dylan.cpp
void Dylan::Window_Open(Win::Event& e)
{
     wchar_t text[64];
     for(int n = 0; n < 100; n++)
     {
          if (n == 10) break;
          _snwprintf_s(text, 64, _TRUNCATE, L"%d ", n);
          this->tbx1.Text += text;
     }     
}

Problem3

Problem 4
Compute the table of variables and the output of the code shown. Suppose there is a textbox called tbx1 with the property of multiline.
Calcule la tabla de variables y la salida del código de abajo. Suponga que hay una caja de texto llamada tbx1 con la propiedad de multilínea.

Dylan.cpp
void Dylan::Window_Open(Win::Event& e)
{
     wchar_t text[64];
     int i = 0, j = 0;
     for(i = 2; i < 4; i++)
     {
          j = 1;
          for(;;)
          {
               _snwprintf_s(text, 64, _TRUNCATE, L"%d ", j);
               tbx1.Text += text;
               j++;
               if (j == 5) break;
          }
          tbx1.Text += L"\r\n";
     }
}

Problem4

Problem 5
Create a Wintempla Dialog application called HolaX to test the following code. After creating the project, add a multiline textbox called tbxOutput.
Cree una aplicación de Wintempla de Diálogo llamada HolaX para probar el siguiente código. Después de crear el proyecto, agregue una caja de texto multilínea llamada tbxOutput.

HolaX.cpp
void HolaX::btAdd_Click(Win::Event& e)
{
     for(int i = 0; i<5; i++)
     {
          tbxOutput.Text += L"Luisa";
     }
}

HolaXRun

Problem 6
Create a Wintempla Dialog application called Gael, after creating the project, add a textbox called tbxOutput. When the user presses the button Add, the word "Alexei" appears the number of times specified by the user.
Cree una aplicación de Wintempla de Diálogo llamada Gael, después de crear el proyecto, agregue una caja de texto llamada tbxOutput. Cuando el usuario presione el botón de Add, la palabra "Alexei" se muestre el número de veces especificado por el usuario.

GaelRun

Problem 7
Create a Wintempla Dialog application called Secrets, after creating the project, add a multiline textbox called tbxOutput. The program must display the sequence of the figure when the user presses the button using the instruction for.
Cree una aplicación de Wintempla de Diálogo llamada Secretos, después de crear el proyecto, agregue una caja de texto llamada tbxOutput. El programa debe mostrar la secuencia de la figura cuando el usuario presione el botón usando la instrucción for.

SecretosRun

Problem 8
Create a Wintempla Dialog application called DeLaVida, after creating the project, add a textbox called tbxOutput.. The program must display the sequence of the figure when the user presses the button using the instruction for.
Cree una aplicación de Wintempla de Diálogo llamada DeLaVida, después de crear el proyecto, agregue una caja de texto llamada tbxOutput. El programa debe mostrar la secuencia de la figura cuando el usuario presione el botón usando la instrucción for.

DeLaVidaRun3

DeLaVidaRun6

Problem 9
Create a Wintempla Dialog application called Satellite, after creating the project, add a multiline textbox called tbxOutput. The program must display the sequence of the figure when the user presses the button using the instruction for.
Cree una aplicación de Wintempla de Diálogo llamada Satellite, después de crear el proyecto, agregue una caja de texto multilínea llamada tbxOutput. El programa debe mostrar la secuencia de la figura cuando el usuario presione el botón usando la instrucción for.

SatelliteRun

Problem 10
Write a program called Cuadrados to display the numbers that are odd and are less than 12 with their respectives squared values.
Escriba un programa llamado Cuadrados que muestre los números impares menores a 12 con sus respectivos cuadrados.

Cuadrados

Problem 11
Create a Wintempla Dialog application called Atlanta, after creating the project, add a multiline textbox called tbxOutput.
Cree una aplicación de Wintempla de Diálogo llamada Atlanta, después de crear el proyecto, agregue una caja de texto multilínea llamada tbxOutput.

Atlanta.cpp
void Atlanta::Window_Open(Win::Event& e)
{
     wchar_t text[64];
     for(int i = 1 ; i < 5; i++)
     {
          _snwprintf_s(text, 64, _TRUNCATE, L"%i\t%i\t%i\r\n", i, 2*i, 3*i);
          tbxOutput.Text += text;
     }
}

Problem 12
Write a program called Odds to display the numbers that are odd in the range from 1 to 19 which are not divisible by 3.
Escriba un programa llamado Odds que muestre los números impares en el rango de 1 a 19 que no son divisibles entre 3.

Odds

Problem 13
Write a program called Both produce the output shown using the instruction for.
Escriba un programa llamado Both para producir la salida mostrada usando la instrucción for.

Both

Problem 14
Write a program called Trigonometria to display a list with the values of the sine and cosine of an angle as shown. Observe that the functions sin(x) and cos(x) implemented by the computer take an angle in radians.
Cree un proyecto llamado Trigonometria que muestre una lista de las funciones seno y coseno para ángulos entre 0 y 90 como se muestra. Observe que las funciones sin(x) y cos(x) implementadas por la computadora toman un ángulo en radianes.

Trigonometria

Problem 15
Create a Wintempla Dialog application called Alex, after creating the project, add a multiline textbox called tbxOutput.
Cree una aplicación de Wintempla de Diálogo llamada Alex, después de crear el proyecto, agregue una caja de texto multilínea llamada tbxOutput.

Alex.h
#pragma once
#include "resource.h"
#define COUNT 3
. . .

Alex.cpp
void Alex::Window_Open(Win::Event& e)
{

     int i=0, j = 0;
     wchar_t text[64];
     for (i = 1; i < COUNT; i++)
     {
          for (j = COUNT-1; j > -1; j--)
          {
               _snwprintf_s(text, 64, _TRUNCATE, L"i = %d, j = %d\r\n", i, j);
               tbxOutput.Text += text;
          }
     }
}


Problem 16
Write a program called SumFact to produce the output shown. The Suma column is the cumulative summation of the numbers until that number. The Factorial column is sequential product of the numbers until that number.
Cree un proyecto llamado SumFact para producir la salida mostrada. La columna de la Suma es la suma acumulativa de los números hasta ese número. La columna de Factorial es el producto secuencial de los números hasta ese número.

SumFact

Problem 16a
Repeat the previous problem using Win32.
Repita el problema previo usando Win32.

SumFact32.cpp
//_________________________________________________ SumFact32.cpp
#include "stdafx.h"
#include "SumFact32.h"
#include <string>
using namespace std;

INT_PTR Window_Open(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
     ::SetWindowText(hWnd, L"SumFact32");
     ...
     return TRUE;
}

INT_PTR CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
     switch (message)
     {
     case WM_INITDIALOG:
          return Window_Open(hWnd, wParam, lParam);
     case WM_COMMAND:
          if (LOWORD(wParam) == IDCANCEL) ::EndDialog(hWnd, 0);
          break;
     }
     return (INT_PTR)FALSE;
}

int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR cmdLine, int cmdShow)
{
     ::DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, WndProc);
     return 0;
}


Problem 17
Create a Wintempla Dialog application called Cristina, after creating the project, add a multiline textbox called tbxOutput.
Cree una aplicación de Wintempla de Diálogo llamada Cristina, después de crear el proyecto, agregue una caja de texto multilínea llamada tbxOutput.

Cristina.cpp
void Cristina::Window_Open(Win::Event& e)
{
     wchar_t text[64];
     int row = 0;
     int col = 0;
     for(row = 1; row < 6; row++)
     {
          for(col = 1; col < 4; col++)
          {
               _snwprintf_s(text, 64, _TRUNCATE, L"%d, %d\t", row, col);
               tbxOutput.Text += text;
          }
          tbxOutput.Text += L"\r\n";
     }
}

Problem 18
Write a program called Logarithmo to compute the logarithm of a number using the method shown below. Observe that this method is only valid for values bigger than 0.5. Stop the number of iterations until the error be less than 0.0001.
Escriba un programa llamado Logarithmo que calcule el logaritmo natural de un número usando la aproximación mostrada debajo. Observe que esta fórmula es válida solamente para valores mayores de 0.5. Detenga el número de iteraciones hasta que el error sea menos de 0.0001.

LogMethod

Logarithmo

Problem 19
Write a program called Integral to compute the area under the function F(x) = sin(x) as shown in the figure.
Cree un programa llamado integral para calcular el área bajo la función F(x) = sin(x) como se muestra en la figura.

Integral

Integral1

Integral2

© Copyright 2000-2021 Wintempla selo. All Rights Reserved. Jul 22 2021. Home